import {createWebHashHistory,createRouter}  from "vue-router";
import welcome from '../view/welcome.vue'
import index from '../view/index.vue'
import brand from '../view/brand.vue'
import product from '../view/product.vue'
import login from '../view/Login.vue'
import size from '../view/size.vue'
import pattern from '../view/pattern.vue'
import category from '../view/category.vue'
import product_size from '../view/product_size.vue'
import charts from  '../view/charts.vue';

/*import pattern from '../view/pattern.vue'*/


const routes=[

    {path:'/login',component: login},
    {
    path:'/',
    name:'index',
    component: index,
        redirect: '/welcome', // 添加重定向到欢迎页面
        children: [
            {path: '/welcome', component: welcome},

             {path: '/brand',component: brand}
            ,
            {path: '/product',component: product},
            {path: '/size',component: size}
            ,
            {path: '/pattern',component: pattern},
            {path: '/category',component: category},
            {path: '/product_size',
             name: 'product_size',
                component: ()=> import('../view/product_size.vue'),
                props: (route) =>({product_id: route.query.product_id})
            },
            {path: '/charts',component: charts}

            ]

}
]

const router=createRouter({
    history:createWebHashHistory(),
    routes
})
export default  router;